def readlist(filename):
    file = open(filename, 'r')
    data = file.readlines()
    return data
def sortm(M):
    N=len(M)
    for i in range(N-1):
        for j in range(N-2,i-1,-1):
            if M[j+1]<M[j]:
                M[j], M[j+1]=M[j+1],M[j]
    return M
import time
m1 = readlist("m1_straight.txt")
m2 = readlist("m2_otherway.txt")
m3 = readlist("m3_random.txt")
M=list(map(int,m1))
t_start=time.time()
print(sortm (M))
t_finish=time.time()
print("Время",round((t_finish-t_start)*1000))
G=list(map(int,m2))
t_start=time.time()
print(G)
t_finish=time.time()
print("Время",round((t_finish-t_start)*1000))
H=list(map(int,m3))
t_start=time.time()
print(sortm (H))
t_finish=time.time()
print("Время",round((t_finish-t_start)*1000))
